﻿using System;
using System.IO;
using System.Web.UI;
using Portal.Core;

public partial class MasterPage_Custom : MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["p"] == null) return;
        var page = Request["p"];
        var dir_page = Request["dir_page"];
        var rootPathPhysical = CoreContext.physicalStaticFile;
        var virtualPath = string.Format("~/Ajax/{1}/{0}.ascx", page, dir_page);
        var pathUc = string.Format("{0}Ajax/{2}/{1}.ascx", rootPathPhysical, page, dir_page);
        var fileExsits = File.Exists(pathUc);
        if (!fileExsits) return;
        var uc = LoadControl(virtualPath);
        ContentPlaceHolderMain.Controls.Add(uc);
    }
}
